//
//  TitleBtn.swift
//  sxwb
//
//  Created by TianDu on 2016/11/14.
//  Copyright © 2016年 TianDu. All rights reserved.
//

import UIKit

class TitleBtn: UIButton {

    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setImage(UIImage(named:"navigationbar_arrow_down"), for: .normal)
        setImage(UIImage(named:"navigationbar_arrow_up"), for: .selected)
        setTitleColor(BlackColor, for: .normal)
        sizeToFit()
    }
    
    ///在swift中,如果重写了init()或者是init(frame)方法,必须重写init?(coder aDecoder: NSCoder)方法
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        titleLabel!.frame.origin.x = 0
        imageView!.frame.origin.x = titleLabel!.frame.size.width+5
    }
}
